<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<font color="red">back必须登录才可以访问 模拟后台处理逻辑</font> <BR>
	<h4> back页面...</h4>
	
	
	<%
		
	//1 获取用户的登录信息
	String username = request.getParameter("username");
	
	System.out.println("username=["+username+"]");
	System.out.println("username是否为空串：["+"".equals(username)+"]");
	
	//2 如果登录信息完整 则把登录信息放到session中
	if(null !=username  && !"".equals(username)){
		session.setAttribute("user", username);
		session.setAttribute(application.getInitParameter("user"), username);
		
		//3 重定向到index.jsp 相对目录
		response.sendRedirect("index.jsp");
	}else{
		//如果没有登录就去登录页面
		response.sendRedirect("login.jsp");
	}
	
	
	
	%>

	<br>
	<a href="index.jsp">回城</a>	
</body>
</html>